package topic;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import util.RabbitUtil;

import java.io.IOException;

public class Provider {

  public static void main(String[] args) throws IOException {

    //获取连接对象
    Connection connection = RabbitUtil.getConnection( );
    Channel channel =connection.createChannel();
    //声明交换机以及交换机类型topic
    channel.exchangeDeclare("topics" ,"topic");
    //发布消息
    String routekey ="all.user.save.findAll";
    channel.basicPublish("topics",routekey,null,("这里是topic动态路由模型的routekey" + routekey).getBytes());

    RabbitUtil.closeConnectionAndChannel(channel,connection);
  }
}
